<template>
	<el-table
		height="350"
		size="small"
		class="box"
		:data="tableData"
		:header-cell-style="{ background: '#f3f8fe', color: '#515a6e' }"
	>
		<el-table-column prop="name" label="省份" sortable></el-table-column>
		<el-table-column prop="value" label="累计用户数" sortable></el-table-column>
		<el-table-column prop="pay_amount" label="支付金额" sortable></el-table-column>
	</el-table>
</template>

<script>
var vk = uni.vk
import citys from "../util/citys.json"

export default {
	data() {
		return {
			tableData: []
		}
	},
	methods: {
		init(res) {
			let allData = vk.pubfn.deepClone(citys)
			allData.map(v => {
				v.pay_amount = 0
				v.value = 0
				let i = vk.pubfn.getListItem(res.selectRes, "_id", v.full)
				if (i) {
					v.pay_amount = i.pay_amount
					v.value = i.count
				}
			})
			this.tableData = allData.sort((a, b) => {
				return b.value - a.value
			})
			this.$emit("comp")
		}
	}
}
</script>

<style lang="scss" scoped>
.box {
	background-color: #fff;
	padding: 8px 16px;
	height: 360px;
	flex: 7;
}
</style>
